program rectangle_square;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  Rectangle = class
public
  a, b: integer;
  private
    c: integer;
    procedure write; virtual;
    procedure update;
  end;

  SmartRectangle = class(Rectangle)
    procedure setting(a1, b1: integer);
    procedure write; override;
end;

procedure Rectangle.write;
begin
  writeln(c);
end;

procedure Rectangle.update;
begin
  c:=a*b;
end;

procedure SmartRectangle.setting(a1, b1 :integer );
begin
  a:=a1;
  b:=b1;
  c:=a*b;
end;

procedure SmartRectangle.write;
begin
  writeln(c)
end;
var
  a1, b1: integer;
  c: Rectangle;
  c1: SmartRectangle;
begin
  readln(a1, b1);
  c:=Rectangle.Create;
  c.a:=a1;
  c.b:=b1;
  c.update;
  c.write;
  c1:=SmartRectangle.Create;
  c1.setting(a1, b1);
  c1.write;
  readln;
end.
